﻿/**
 * BoardAction.java 1.0 2007-4-20 上午01:46:27,创建 by yangfan
 */


package org.in4j.bbs.action;

import java.util.List;

import org.in4j.bbs.model.Category;
import org.in4j.bbs.model.User;
import org.in4j.bbs.service.ForumService;
import org.in4j.bbs.service.UserService;

/**
 * 首页
 *
 * @author yangfan
 * @version 1.0 2007-4-20 上午01:46:27,创建
 */
public class IndexAction extends AbstractAction
{
    private static final long serialVersionUID = 1L;

    private UserService userService;

    private ForumService forumService;

    private List<Category> categories;

    private int topicCount;

    private int postCount;

    private int userCount;

    private User user;

    public String execute() throws Exception
    {
        this.categories = forumService.listAllCategorys();
        this.topicCount = forumService.getTopicCount();
        this.postCount = forumService.getPostCount();
        this.userCount = userService.getUserCount();
        this.user = getOnlineInfo().getUser();
        return "index";
    }

    public User getUser()
    {
        return user;
    }

    public int getPostCount()
    {
        return postCount;
    }

    public List<Category> getCategories()
    {
        return categories;
    }

    public int getUserCount()
    {
        return userCount;
    }

    public int getTopicCount()
    {
        return topicCount;
    }

    public void setForumService(ForumService forumService)
    {
        this.forumService = forumService;
    }

     public void setUserService(UserService userService)
    {
        this.userService = userService;
    }
}
